<template>
  <div class="case-page">
    <!-- 医院名称 -->
    <h1 class="hospital-name" style="margin-bottom: 3px">{{ info.title }}</h1>
    <h1 class="hospital-name">挂号单</h1>
    <h1 class="hospital-name" >序号：上午 · 0001</h1>
    <div class="dotted"></div>
    <div class="content_item" style="margin-top: 20px;">
      <div>姓名：张三    男    22岁10月</div>
      <div>电话：17712341234</div>
      <div>科室：内科</div>
      <div>诊室：1诊室</div>
      <div>医生：张三</div>
      <div>类型：初诊（普通）</div>
    </div>
    <div class="dashed"></div>
    <div class="content_item">
      <div>就诊日期：2019-12-11 周三</div>
      <div>就诊备注：咳嗽</div>
    </div>
    <div class="dashed"></div>
    <div class="content_item" >
      <div style="display: flex;">
        <div>金额：</div>
        <div style="margin-left: auto;">450.00</div>
      </div>
      <div style="display: flex;">
        <div>实付：</div>
        <div style="margin-left: auto;">900.25(支付宝)</div>
      </div>
    </div>
    <div class="dashed"></div>
    <div class="content_item">
      <div>打印人员：张三</div>
      <div>打印时间：2025-08-14 09:00:00</div>
      <div>地址：{{info.address}}</div>
      <div>电话：{{info.phone}}</div>
    </div>
    <div class="dotted" style="margin-top: 20px;"></div>
    <div
        v-if="qrCodeStr != ''"
        style="width: 100%; text-align: center; margin: 15px  0 0"
      >
        <img
          :src="qrCodeStr"
          style="
            width: 96px;
            height: 96px;
            display: inline-block;
            margin: 0 auto;
          "
          alt="二维码"
        />
      </div>
      <div style="text-align: center; ">
        当日有效 过期作废
      </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive } from 'vue';
import QRCode from 'qrcode';

export default defineComponent({
  name: 'CasePage',
  props:['info'],     
  data() {
    return {
      qrCodeStr: '',
    };
  },
  mounted() {
      QRCode.toDataURL('123123132', (err: Error | null, url: string) => {
        if (err) {
          //console.error('二维码生成失败:', err);

          return;
        }
        this.qrCodeStr = url;
      });

  },
});
</script>

<style scoped lang="scss">
.case-page {
  font-family: Arial, sans-serif;
  padding: 34px 30px;background-color: #fff;
  height: 100%;
  width: 335px;
  margin: auto;
  font-size: 12px;
}
.hospital-name {
  text-align: center;
  font-size: 16px;
  margin-bottom: 15px;

}


.content_item  >div{
    line-height: 1.5;
  }
.dashed{
  margin: 10px 0;
  border: 1px dashed #666;
}
.dotted{
  width: 100%;
  height: 5px;
  background: 
   linear-gradient(90deg, #000 63%, transparent 0) repeat-x, linear-gradient(90deg, #000 63%, transparent 0) repeat-x;
  background-size: 9px 1px; /* 控制虚线长度和间隔 */
  background-position: 0 0, 0 100%, 0 0, 100% 0;
}

</style>
